const Router = require('koa-router');
const siteCollectModel = require('../../models/siteCollect')
const router = new Router();

router.post("/siteCollect",async ctx =>{
    console.log(ctx.request.body);
    const newSite = new siteCollectModel({
        site:ctx.request.body.site,
        describe:ctx.request.body.describe
    })

    await newSite.save();
    ctx.status = 200;

})

router.get('/sites',async ctx =>{
    await siteCollectModel.find(function (err,result) {
        ctx.body = result
    })
})

module.exports = router.routes();